<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
Route::get('/test', function(){
    return phpinfo();
});

Route::post('/login/authorization', 'TokenController/store');
Route::post('/company/authorization', 'TokenController/companyStore');

Route::get('/admin/company/exportTemplate', 'CompanyController/exportTemplate');
Route::get('/admin/company/exportData', 'CompanyController/exportData');

Route::get('/admin/signup/exportData', 'SignupController/exportData');
Route::get('/admin/signup/exportTemplate', 'SignupController/exportTemplate');

Route::get('/admin/score/exportData', 'ScoreController/exportData');
Route::get('/admin/score/exportTemplate', 'ScoreController/exportTemplate');

Route::post('/sign', 'CompanyController/store');

Route::group('admin', function () {
    //企业
    Route::group('company', function () {
        Route::get('/exportData', 'exportData');
        // Route::get('/exportTemplate', 'exportTemplate');
        Route::post('/import', 'import');
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Company::class);
        Route::patch(':id', 'save')->model(\app\model\Company::class);
        Route::delete(':id', 'delete')->model(\app\model\Company::class);
        
    })->prefix('CompanyController/');

    //用户
    Route::group('user', function () {
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\User::class);
        Route::patch(':id', 'save')->model(\app\model\User::class);
        Route::delete(':id', 'delete')->model(\app\model\User::class);
    })->prefix('UserController/');

    //计划
    Route::group('plan', function () {
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Plan::class);
        Route::patch(':id', 'save')->model(\app\model\Plan::class);
        Route::delete(':id', 'delete')->model(\app\model\Plan::class);
    })->prefix('PlanController/');

    //模板
    Route::group('template', function () {
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Template::class);
        Route::patch(':id', 'save')->model(\app\model\Template::class);
        Route::delete(':id', 'delete')->model(\app\model\Template::class);
    })->prefix('TemplateController/');

    //报名
    Route::group('signup', function () {
        Route::post('/import', 'import');
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Signup::class);
        Route::patch(':id', 'save')->model(\app\model\Signup::class);
        Route::delete(':id', 'delete')->model(\app\model\Signup::class);
    })->prefix('SignupController/');

    //考试计划
    Route::group('userplan', function () {
        Route::get('/exportData', 'exportData');
        Route::get('/exportTemplate', 'exportTemplate');
        Route::post('/import', 'import');
        Route::get('/', 'index');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Userplan::class);
        Route::patch(':id', 'save')->model(\app\model\Userplan::class);
        Route::delete(':id', 'delete')->model(\app\model\Userplan::class);
    })->prefix('UserplanController/');

    //考试成绩
    Route::group('score', function () {
        Route::get('/exportData', 'exportData');
        Route::get('/exportTemplate', 'exportTemplate');
        Route::post('/import', 'import');
        Route::post('/', 'store');
        Route::get(':id', 'show')->model(\app\model\Score::class);
        Route::patch(':id', 'save')->model(\app\model\Score::class);
        Route::delete(':id', 'delete')->model(\app\model\Score::class);
    })->prefix('ScoreController/');

    //上传
    Route::group('upload', function () {
        Route::post('/', 'upload');
    })->prefix('UploadController/');

})/*->middleware(\app\middleware\CheckAuth::class)*/;


Route::post('admin/signup', 'SignupController/store')->middleware(\app\middleware\CheckCompantAuth::class);
Route::get('admin/score', 'ScoreController/index')/*->middleware(\app\middleware\CheckCompantAuth::class)*/;
Route::get('home/score', 'ScoreController/homeIndex');
Route::get('home/template/:id', 'TemplateController/homeShow')->model(\app\model\Template::class);
